<?php

// put full path to Smarty.class.php
require('/usr/share/pear/Smarty/Smarty.class.php');
$smarty = new Smarty();

$base_app_dir = '/var/www/endeepen/';

//$smarty->template_dir = $base_app_dir ;
$smarty->compile_dir = $base_app_dir . 'smarty/templates_c';
$smarty->cache_dir = $base_app_dir . 'smarty/cache';
$smarty->config_dir = $base_app_dir . 'smarty/configs';


include_once('common.php');

$template =  $base_app_dir . "instances/" . $config_instance . "/theme/topic.tpl";





$stories = ((int)$include_stories) ? topic_getRelatedStories($topic_name, $topic_id, $start_time_stories, $end_time_stories, $sort_stories, $offset, $limit_stories, $include_scores_stories) : null;

$images = ((int)$include_images) ? topic_getRelatedImages($topic_name, $topic_id, $start_time_images, $end_time_images, $sort_images, $offset, $limit_images, $include_publication_images, $filter_id_images) : null;

$topics = ((int)$include_connections) ? topic_getRelatedTopics($topic_name, $topic_id, $start_time, $end_time, $sort_connections, $offset, $limit_connections, $include_topic_type_connections, $include_image_connections) : null;

$quotes = ((int)$include_quotes) ? topic_getRelatedQuotes($topic_name, $topic_id, $start_time_quotes, $end_time_quotes, $sort_quotes, $offset, $limit_quotes) : null;


$custom_header = get_custom_header();

$custom_footer = get_custom_footer();

$custom_css = get_custom_css();


$smarty->assign('custom_header',$custom_header);
$smarty->assign('custom_footer',$custom_footer);
//$smarty->assign('custom_css',$custom_css);
$smarty->assign('topic_name', $topic_name);
$smarty->assign('stories', $stories);
$smarty->assign('quotes', $quotes);
$smarty->assign('images', $images);
$smarty->assign('topics', $topics);


$smarty->register_outputfilter('insert_dynamic_page_items');
$smarty->register_outputfilter('insert_admin_layer');
$smarty->register_outputfilter('insert_custom_styles');
$smarty->display("file:$template");


?>

